#include<bits/stdc++.h>
using namespace std;
const int maxn = 200+7;
typedef pair<int, int> pi;
int k[maxn];
bool vis[maxn];
int dk[] = {1, -1};
int n, a, b;
queue<pi> q;
void bfs() {
  q.push(make_pair(a, 0));
  vis[a] = true;
  while(q.size()) {
    int now = q.front().first, dep=q.front().second; q.pop();
    if(now==b) {
      cout<<dep<<'\n'; return;
    }
    for(int i=0; i<2; ++i) {
      int nxt = now+k[now]*dk[i];
      if(nxt<=0 || nxt>n || vis[nxt]) continue;
      vis[nxt] = true;
      q.push(make_pair(nxt, dep+1));
    }
  }
  cout<<"-1\n";
}
int main() {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin>>n>>a>>b; for(int i=1; i<=n; ++i) cin>>k[i];
  bfs();
}
